package com.smart.draw.plantuml;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

/**
 * @Author xiaoqiang
 * @Version UrlHelper.java, v 0.1 2025年08月26日 23:26 xiaoqiang
 * @Description: TODO
 */

public class UrlHelper {

    public static String getCurrentUrl(HttpServletRequest request) {
        return ServletUriComponentsBuilder
                .fromCurrentRequestUri()
                .build()
                .toUriString();
    }

    public static String getBaseUrl(HttpServletRequest request) {
        return ServletUriComponentsBuilder
                .fromRequestUri(request)
                .build()
                .toUriString();
    }
}
